package cn.orange.ch10_dynamicprogramming;

import java.util.Arrays;

/**
 * LC674.最长连续递增序列
 */
public class LC674 {
    public int findLengthOfLCIS(int[] nums) {
        int n = nums.length;
        //dp[i]:以下标i结尾的最长连续递增子序列长度为dp[i]
        int[] dp = new int[n];
        Arrays.fill(dp, 1);
        int max = 1;
        for (int i = 1; i < n; i++) {
            if (nums[i] > nums[i - 1]) {
                dp[i] = 1 + dp[i - 1];
            }
            max = Math.max(dp[i], max);
        }
        return max;
    }

    public static void main(String[] args) {
        LC674 alg = new LC674();
        System.out.println(alg.findLengthOfLCIS(new int[]{10, 9, 2, 5, 3, 7, 101, 18}));
        System.out.println(alg.findLengthOfLCIS(new int[]{0, 1, 0, 3, 2, 3}));
        System.out.println(alg.findLengthOfLCIS(new int[]{1, 3, 6, 7, 9, 4, 10, 5, 6}));
    }
}
